function reallocReal(p,n)
  use param
  implicit none

  real(dbl),pointer,dimension(:) :: reallocReal,p
  integer,intent(in) :: n

  integer :: ierr,i

  allocate(reallocReal(1:n),stat=ierr)

  if (ierr.ne.0) call abnormal_stop("reallocReal",&
       "Memory allocation causes an error.")

  if (.not.associated(p)) return

  do i=1,n-1
     reallocReal(i)=p(i)
  end do

  deallocate(p)

  return

end function reallocReal
